package com.yunxi.service.dubboService.impl.finance;

import cn.jiguang.common.utils.StringUtils;
import com.alibaba.dubbo.rpc.RpcContext;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageInfo;
import com.yunxi.baseDataToHub.pojo.sap.RebateAmountVO;
import com.yunxi.baseDataToHub.service.sap.SapDubboService;
import com.yunxi.bizToBaseData.pojo.DictVO;
import com.yunxi.bizToBaseData.service.Customer2BizDubboService;
import com.yunxi.bizToBaseData.service.Dict2BizDubboService;
import com.yunxi.core.base.Constant;
import com.yunxi.core.enums.DMSEnumsEntity;
import com.yunxi.core.util.WgrDate;
import com.yunxi.core.web.ApiResult;
import com.yunxi.core.web.LoginInfo;
import com.yunxi.customer.pojo.CustomerVO;
import com.yunxi.customer.service.CustomerDubboService;
import com.yunxi.finance.pojo.*;
import com.yunxi.finance.service.DynamicRebateCommissionDubboService;
import com.yunxi.model.finance.DynamicRebateCommission;
import com.yunxi.model.finance.RebateCommission;
import com.yunxi.model.order.OrderCustomer;
import com.yunxi.model.order.OrderVehicle;
import com.yunxi.model.sat.HandleVehicle;
import com.yunxi.model.sat.SatTestDrive;
import com.yunxi.service.localService.CodeCreateService;
import com.yunxi.service.localService.OrderCustomerService;
import com.yunxi.service.localService.OrderVehicleService;
import com.yunxi.service.localService.finance.DynamicRebateCommissionService;
import com.yunxi.service.localService.finance.RebateCommissionService;
import com.yunxi.service.localService.impl.CodeCreateServiceImpl;
import com.yunxi.service.localService.sat.HandleVehicleService;
import com.yunxi.service.localService.sat.SatTestDriveService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.transaction.annotation.Transactional;

import java.lang.reflect.InvocationTargetException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;

/**
 * <p>
 * 返利与佣金 服务实现类
 * </p>
 *
 * @author 
 * @since 2019-09-16
 */
public class DynamicRebateCommissionDubboServiceImpl implements DynamicRebateCommissionDubboService {

    private final Logger logger = LoggerFactory.getLogger(DynamicRebateCommissionDubboServiceImpl.class);

    @Autowired
    @Qualifier(value = "dynamicRebateCommissionServiceImpl")
    DynamicRebateCommissionService dynamicRebateCommissionService;

    @Autowired
    @Qualifier(value = "rebateCommissionServiceImpl")
    RebateCommissionService rebateCommissionService;


    @Autowired
    SapDubboService sapDubboServiceImpl;

    @Autowired
    @Qualifier(value = "codeCreateServiceImpl")
    CodeCreateService codeCreateServiceImpl;

    @Autowired
    @Qualifier(value = "orderCustomerServiceImpl")
    OrderCustomerService orderCustomerServiceImpl;

    @Autowired
    @Qualifier(value = "handleVehicleServiceImpl")
    HandleVehicleService handleVehicleServiceImpl;

    @Autowired
    CustomerDubboService customerDubboServiceImpl;

    @Autowired
    @Qualifier(value = "satTestDriveServiceImpl")
    SatTestDriveService satTestDriveServiceImpl;

    @Autowired
    Dict2BizDubboService dict2BizDubboService;

    @Autowired
    @Qualifier(value = "orderVehicleServiceImpl")
    OrderVehicleService orderVehicleServiceImpl;

    @Autowired
    Customer2BizDubboService customer2BizDubboService;

    @Override
    public DynamicRebateCommissionQueryRespVO getById(String id) throws InvocationTargetException, IllegalAccessException {
        DynamicRebateCommission dynamicRebateCommission = dynamicRebateCommissionService.getById(id);
        DynamicRebateCommissionQueryRespVO dynamicRebateCommissionVO = new DynamicRebateCommissionQueryRespVO();
        BeanUtils.copyProperties(dynamicRebateCommission, dynamicRebateCommissionVO);
        return dynamicRebateCommissionVO;
    }

    @Override
    public void saveOrUpdate(DynamicRebateCommissionQueryReqVO dynamicRebateCommissionVO) throws InvocationTargetException, IllegalAccessException {
        DynamicRebateCommission dynamicRebateCommission = new DynamicRebateCommission();
        BeanUtils.copyProperties(dynamicRebateCommissionVO, dynamicRebateCommission);
        dynamicRebateCommissionService.saveOrUpdate(dynamicRebateCommission);
    }

    @Override
    public void save(DynamicRebateCommissionQueryReqVO dynamicRebateCommissionVO){
        dynamicRebateCommissionVO.setIsDynamic(2);   //动态返利
        dynamicRebateCommissionVO.setAuditStatus(2); //待审核
        DynamicRebateCommission dynamicRebateCommission = new DynamicRebateCommission();
        BeanUtils.copyProperties(dynamicRebateCommissionVO,dynamicRebateCommission);
        String rebateCode = codeCreateServiceImpl.createCode("RC", CodeCreateServiceImpl.DATE_FORMAT_TWO,10);
        dynamicRebateCommission.setRebateCode(rebateCode);
        dynamicRebateCommissionService.save(dynamicRebateCommission);
    }

    @Override
    public void removeById(String id) {
        dynamicRebateCommissionService.removeById(id);
    }

    @Override
    public PageInfo<DynamicRebateCommissionQueryRespVO> findPageByVO(DynamicRebateCommissionQueryReqVO dynamicRebateCommissionVO, Integer pageNum, Integer pageSize) throws InvocationTargetException, IllegalAccessException {
      PageInfo<DynamicRebateCommissionQueryRespVO> pageInfo = dynamicRebateCommissionService.pageByVo(dynamicRebateCommissionVO,pageNum,pageSize);
      return pageInfo;
    }

    @Override
    public void removeByListVo(List<DynamicRebateCommissionQueryReqVO> dynamicRebateCommissionVOList) throws IllegalAccessException, InvocationTargetException, InstantiationException {
        dynamicRebateCommissionService.removeByListVo(dynamicRebateCommissionVOList);
    }

    @Override
    public List listByVo(DynamicRebateCommissionQueryReqVO dynamicRebateCommissionVO) {
      return dynamicRebateCommissionService.listByVo(dynamicRebateCommissionVO);
    }

    /**
     * 返利与佣金主数据查询
     * @param dynamicRebateCommissionVO
     * @param pageNum
     * @param pageSize
     * @return
     */
    @Override
    public PageInfo<DynamicRebateCommissionQueryRespVO> queryDynamicRebateCommissionByList(DynamicRebateCommissionQueryReqVO dynamicRebateCommissionVO, Integer pageNum, Integer pageSize) {
        return dynamicRebateCommissionService.queryDynamicRebateCommissionByList(dynamicRebateCommissionVO, pageNum, pageSize);
    }

    @Override
    public DynamicRebateCommissionQueryRespVO queryDynamicRabateCommissionBySingle(DynamicRebateCommissionQueryReqVO vo) {
        return dynamicRebateCommissionService.queryDynamicRabateCommissionBySingle(vo);
    }

    /**
     * 审核
     * @param vo
     * @return
     */
    @Override
    public boolean audit(DynamicRebateCommissionAuditReqVO vo){

        QueryWrapper qw = new QueryWrapper();
        qw.eq("DYNAMIC_ID", vo.getDynamicId());

        DynamicRebateCommission dynamicRebateCommission = new DynamicRebateCommission();
        dynamicRebateCommission.setAuditBy(vo.getAuditBy());
        dynamicRebateCommission.setAuditInfo(vo.getAuditInfo());
        dynamicRebateCommission.setAuditStatus(vo.getAuditStatus());
        //dynamicRebateCommission.setAuditTime(new Date());
        dynamicRebateCommissionService.update(dynamicRebateCommission, qw);

        //
        //审核通过调用SAP
        if(vo.getAuditStatus() == 1){

            DynamicRebateCommission entity = dynamicRebateCommissionService.getOne(qw);

            RebateAmountVO rebateAmountVO = new RebateAmountVO();
            rebateAmountVO.setBelnr("");
            rebateAmountVO.setBudat(WgrDate.date2Str(new Date(),"yyyy-MM-dd"));
            rebateAmountVO.setBurks(Constant.PMS_REBATE_COMMISSION_BURKS);//AS51上海销售
            rebateAmountVO.setIndicator("1"); //指示操作符 新增
            rebateAmountVO.setKunnr(entity.getPartnerCode());
            rebateAmountVO.setProctype("4");
            rebateAmountVO.setSeqno(entity.getRebateCode());
            rebateAmountVO.setWaers("RMB");
            rebateAmountVO.setWrbtr(entity.getRabateAmount().toString());

            try {

                ApiResult sapResult = sapDubboServiceImpl.sendRebateAmountPms2Sap(rebateAmountVO);

                if (200 != sapResult.getCode()) {
                    logger.info("SAP 返利发放金额同步接口调用失败");
                    return false;
                }
            }catch(Exception ex){
                logger.error("SAP 返利发放金额同步接口调用失败{}",ex);
                throw new RuntimeException("SAP 返利发放金额同步接口调用失败",ex);
            }

        }
        return true;
    }

    /**
     * 查询自有资金返利
     *
     * 此业务针对批售业务发生
     * 当渠道商使用现金采购车辆时,使用自有资金,所以才产生自有资金返利
     *  车辆发运后调用此接口计算返利信息
     */
    public void rebateForZiYouZiJin(String orderNo){

        QueryWrapper qw = new QueryWrapper();
        qw.eq("ORDER_CAR_ID",orderNo);//订单号
        OrderVehicle orderVehicle = orderVehicleServiceImpl.getOne(qw);
        if(orderVehicle == null){
            logger.debug("批售订单不存在 ====== "+orderNo);
            return;
        }

        //判断订单是否是自有资金
        if(!DMSEnumsEntity.AccountType.CASH.getCode().equals(orderVehicle.getPayway())){
            return;
        }

        //
        //自有资金返利
        KeepAccountsReqVO vo = new KeepAccountsReqVO();
        vo.setAmount(orderVehicle.getSettlementPrice()==null?new BigDecimal(0):orderVehicle.getSettlementPrice());//结算价
        vo.setIsDynamic(1);
        vo.setPartnerCode(orderVehicle.getPartnerCode());
        vo.setRebateName("自有资金返利");
        vo.setRebateType(1);//返利类型 1自有资金
        vo.setOrderNo(orderNo);
        callSapInvokeRebate(vo);
    }

    /**
     * 查询客户来源返利
     *  1,非URM获取的客户,渠道商通过销售助手自己创建的客户
     *  2,如果多个渠道商都创建了同一个客户,则取第一个创建的客户进行返利
     *  3,以手机号为唯一性校验
     *
     * @param
     */
    public void queryKeHuLaiYuanRebate(OrderCustomer orderCustomer){
//        QueryWrapper qw = new QueryWrapper();
//        qw.eq("ORDER_CUSTOMER_NO",orderNo);
//        OrderCustomer orderCustomer = orderCustomerServiceImpl.getOne(qw);
//
//        if(orderCustomer == null){
//            return;
//        }

//        CustomerVO customerVO = customerDubboServiceImpl.queryCustomerByCustomerNo(orderCustomer.getCustomerNo(),
//                orderCustomer.getPartnerCode());
//        if(customerVO == null){
//            return;
//        }

        //根据客户电话,查找手机APP创建的第一条记录,如果存在,则给第一条记录对应的渠道商创建客户来源类型的返利
        String phone = orderCustomer.getCustomerMobile();
        String partnerCode = customer2BizDubboService.getFirstCreateCustomerPartnerCode(phone);

        if(StringUtils.isEmpty(partnerCode)){
            logger.debug("客户不是销售助手创建 ===== " + phone);
            return;
        }


        //
        //客户来源返利
        KeepAccountsReqVO vo = new KeepAccountsReqVO();
        vo.setAmount(orderCustomer.getTotalAmount()==null?new BigDecimal(0):orderCustomer.getTotalAmount());
        vo.setIsDynamic(1);
        vo.setPartnerCode(partnerCode);//给第一个通过销售助手创建的渠道商返利
        vo.setRebateName("客户来源返利");
        vo.setRebateType(3);//返利类型 3客户来源
        vo.setOrderNo(orderCustomer.getOrderCustomerNo());
        callSapInvokeRebate(vo);
    }

    /**
     * 查询交车的返利
     * @param
     */
    public void queryJiaoCheRebate(OrderCustomer orderCustomer){
//        QueryWrapper qw = new QueryWrapper();
//        qw.eq("ORDER_CUSTOMER_NO",orderNo);
//        qw.eq("HANDLE_STATUS","2");
//        HandleVehicle handleVehicle = handleVehicleServiceImpl.getOne(qw);
//        if(handleVehicle == null){
//            return;
//        }
//
//        QueryWrapper qwOrderCustomer = new QueryWrapper();
//        qw.eq("ORDER_CUSTOMER_NO",orderNo);
//        qw.eq("BUY_TYPE","1"); // 购车
//        OrderCustomer orderCustomer = orderCustomerServiceImpl.getOne(qwOrderCustomer);
//
//        if(orderCustomer == null){
//            return;
//        }
        //
        //交车返利
        KeepAccountsReqVO vo = new KeepAccountsReqVO();
        vo.setAmount(orderCustomer.getTotalAmount()==null?new BigDecimal(0):orderCustomer.getTotalAmount());
        vo.setIsDynamic(1);
        vo.setPartnerCode(orderCustomer.getPartnerCode());
        vo.setRebateName("交车返利");
        vo.setRebateType(5);//返利类型 5交车
        vo.setOrderNo(orderCustomer.getOrderCustomerNo());
        callSapInvokeRebate(vo);
    }

    /**
     * 查询订单返利
     */
    public void queryOrderRebate(OrderCustomer orderCustomer){
//        QueryWrapper qw = new QueryWrapper();
//        qw.eq("ORDER_CUSTOMER_NO",orderNo);
//        qw.eq("BUY_TYPE","1"); // 购车
//        OrderCustomer orderCustomer = orderCustomerServiceImpl.getOne(qw);
//
//        if(orderCustomer == null){
//            return;
//        }

        //
        //订单返利
        KeepAccountsReqVO vo = new KeepAccountsReqVO();
        vo.setAmount(orderCustomer.getTotalAmount()==null?new BigDecimal(0):orderCustomer.getTotalAmount());
        vo.setIsDynamic(1);
        vo.setPartnerCode(orderCustomer.getPartnerCode());
        vo.setRebateName("订单返利");
        vo.setRebateType(2);//返利类型 2订单返利
        vo.setOrderNo(orderCustomer.getOrderCustomerNo());
        callSapInvokeRebate(vo);
    }


    /**
     * 查询试乘试驾返利
     * 试乘试驾返利规则：
     * 第一次试乘试驾
     *
     * @param
     */
    public void queryShiChengShiJiaRebate(OrderCustomer orderCustomer){
//        QueryWrapper qw = new QueryWrapper();
//        qw.eq("ORDER_CUSTOMER_NO",orderNo);
//        qw.eq("BUY_TYPE","1"); // 购车
//        OrderCustomer orderCustomer = orderCustomerServiceImpl.getOne(qw);
//
//        if(orderCustomer == null){
//            return;
//        }
        //查询当前客户最近一次成交的订单的上一次成交记录
        QueryWrapper qwTmp = new QueryWrapper();
        qwTmp.eq("CUSTOMER_NO",orderCustomer.getCustomerNo());
        qwTmp.orderByDesc("CREATE_TIME");
        List<OrderCustomer> tmp = orderCustomerServiceImpl.list(qwTmp);

        OrderCustomer lastOrderCustomer = null;
        if(tmp.size() > 2) {
            lastOrderCustomer = tmp.get(1);
        }

        QueryWrapper qwTestDrive = new QueryWrapper();
        qwTestDrive.eq("CUSTOMER_NO",orderCustomer.getCustomerNo());
        qwTestDrive.le("BEGIN_DRIVE_TIME",orderCustomer.getCreateTime());

        if(lastOrderCustomer != null){
            //
            //表示当前客户不是第一次购买车辆（购买多次）
            qwTestDrive.ge("BEGIN_DRIVE_TIME",lastOrderCustomer.getCreateTime());
        }

        qwTestDrive.orderByAsc("BEGIN_DRIVE_TIME");
        List<SatTestDrive> entities = satTestDriveServiceImpl.list(qwTestDrive);

        if(entities.size() <= 0){
            return;
        }

        //返利给他
        //
        //自有资金返利
        KeepAccountsReqVO vo = new KeepAccountsReqVO();
        vo.setAmount(orderCustomer.getTotalAmount()==null?new BigDecimal(0):orderCustomer.getTotalAmount());
        vo.setIsDynamic(1);
        vo.setPartnerCode(entities.get(0).getPartnerCode());
        vo.setRebateName("试乘试驾返利");
        vo.setRebateType(4);//返利类型 2订单返利
        vo.setOrderNo(orderCustomer.getOrderCustomerNo());
        callSapInvokeRebate(vo);
    }

    /**
     * 返利
     * @param vo
     * @return
     */
    public boolean callSapInvokeRebate(KeepAccountsReqVO vo){
        if(vo == null){
            throw new RuntimeException("KeepAccountsReqVO 参数不能为Null");
        }

        QueryWrapper qwQueryRebateRatioByRebateType = new QueryWrapper();
        qwQueryRebateRatioByRebateType.eq("REBATE_TYPE",vo.getRebateType());
        RebateCommission rebateCommission = rebateCommissionService.getOne(qwQueryRebateRatioByRebateType);

        String rebateCode = codeCreateServiceImpl.createCode("RC", CodeCreateServiceImpl.DATE_FORMAT_TWO,10);

        //
        //固定返利比例*金额 = 返利金额
        BigDecimal rebateAmount = vo.getAmount().multiply(rebateCommission.getRebateRatio() ==null?new BigDecimal(0): rebateCommission.getRebateRatio());



        RebateAmountVO rebateAmountVO = new RebateAmountVO();
        rebateAmountVO.setBelnr("");
        rebateAmountVO.setBudat(WgrDate.date2Str(new Date(),"yyyy-MM-dd"));
        rebateAmountVO.setBurks(Constant.PMS_REBATE_COMMISSION_BURKS);//AS51上海销售
        rebateAmountVO.setIndicator("1"); //指示操作符 新增
        rebateAmountVO.setKunnr(vo.getPartnerCode());
        rebateAmountVO.setProctype("4");
        rebateAmountVO.setSeqno(rebateCode);
        rebateAmountVO.setWaers("RMB");
        rebateAmountVO.setWrbtr(rebateAmount.toString());

        try {

            ApiResult sapResult = sapDubboServiceImpl.sendRebateAmountPms2Sap(rebateAmountVO);

            if (200 != sapResult.getCode()) {
                logger.info("SAP 返利发放金额同步接口调用失败");
                throw new RuntimeException("SAP 返利发放金额同步接口调用失败,请核实！");
            }
        }catch(Exception ex){
            logger.error("SAP 返利发放金额同步接口调用失败{}",ex);
            throw new RuntimeException("SAP 返利发放金额同步接口调用失败",ex);
        }

        DynamicRebateCommission dynamicRebateCommission = new DynamicRebateCommission();
        dynamicRebateCommission.setRebateCode(rebateCode);
        dynamicRebateCommission.setPartnerCode(vo.getPartnerCode());
        dynamicRebateCommission.setRabateName(vo.getRebateName());
        dynamicRebateCommission.setRabateAmount(rebateAmount);
        dynamicRebateCommission.setRabateTime(new Date());
        dynamicRebateCommission.setRabateType(vo.getRebateType());
        dynamicRebateCommission.setOrderNo(vo.getOrderNo());
        dynamicRebateCommission.setIsDynamic(vo.getIsDynamic());
        dynamicRebateCommission.setAuditStatus(1);
        dynamicRebateCommissionService.save(dynamicRebateCommission);
        return true;
    }

    /**
     * 实销返利
     * @param orderNo
     * @return
     */
    @Override
    @Transactional
    public boolean keepAccounts(String orderNo){
//        queryZiYouZiJinRebate(orderNo);//自有资金返利在车辆发运时触发,属于批售业务

        //查询订单信息
        QueryWrapper qw = new QueryWrapper();
        qw.eq("ORDER_CUSTOMER_NO",orderNo);
        OrderCustomer orderCustomer = orderCustomerServiceImpl.getOne(qw);
        if(orderCustomer == null){
            logger.debug("未找到此订单信息 ==== " + orderNo);
            return false;
        }

        queryOrderRebate(orderCustomer);
        queryShiChengShiJiaRebate(orderCustomer);
        queryKeHuLaiYuanRebate(orderCustomer);
        queryJiaoCheRebate(orderCustomer);
        return true;
    }

    /**
     * 查询导出返利主数据
     * @param vo
     * @return
     */
    @Override
    public List<DynamicRebateCommissionQuerySumRespVO> queryExportDataMainData(DynamicRebateCommissionQueryReqVO vo){
        return dynamicRebateCommissionService.queryExportDataMainData(vo);
    }

    /**
     * 查询导出订单返利信息
     * @param vo
     * @return
     */
    @Override
    public List<OrderRebateQueryRespVO> queryOrderRebateByList(DynamicRebateCommissionQueryReqVO vo){
        return dynamicRebateCommissionService.queryOrderRebateByList(vo);
    }

    /**
     * 查询导出交车返利信息
     * @param vo
     * @return
     */
    @Override
    public List<HandleRebateQueryRespVO> queryHandleRebateByList(DynamicRebateCommissionQueryReqVO vo){
        return dynamicRebateCommissionService.queryHandleRebateByList(vo);
    }

    /**
     * 客户来源返利信息
     * @param vo
     * @return
     */
    @Override
    public List<CustomerRebateQueryRespVO> queryCustomerRebateByList(DynamicRebateCommissionQueryReqVO vo){
        return dynamicRebateCommissionService.queryCustomerRebateByList(vo);
    }

    @Override
    public ApiResult importData(DynamicRebateCommissionImportReqVO vo){
        ApiResult apiResult = new ApiResult();
        apiResult.setCode(200);
        apiResult.setMsg("成功");
        //获取当前用户
        String currentUserStr = RpcContext.getContext().getAttachment("currentUser");
        LoginInfo loginInfo = JSONObject.parseObject(currentUserStr, LoginInfo.class);
        String createUser = loginInfo.getUserCode();
        //查询字典
        List<DictVO> dictList = dict2BizDubboService.getDictListByType("rebateType");
        HashMap dictMap = new HashMap();
        for(DictVO dictVO : dictList){
            dictMap.put(dictVO.getDictValue(),dictVO.getDictKey());
        }

//        List<String> partnerList = new ArrayList<>();//校验渠道商是否存在

        List<DynamicRebateCommission> entities = new ArrayList<>();
        for(DynamicRebateCommissionQueryReqVO entity : vo.getList()){
            if(!"用户满意度".equals(entity.getRabateTypeName()) &&
                !"属地及市场推广".equals(entity.getRabateTypeName()) &&
                        !"人员及设施".equals(entity.getRabateTypeName())){
                apiResult.setMsg("返利类型不合法:" + entity.getRabateTypeName());
                apiResult.setCode(502);
                return apiResult;
            }
            entity.setRabateType(dictMap.get(entity.getRabateTypeName()) == null ? null : Integer.parseInt((String)dictMap.get(entity.getRabateTypeName())));
            DynamicRebateCommission en = new DynamicRebateCommission();
            BeanUtils.copyProperties(entity, en);
            en.setAuditStatus(2);
            en.setIsDynamic(2);
            en.setCreateTime(new Date());
            en.setCreateBy(createUser);
            entities.add(en);

            //保证不重复

//            if(!partnerList.contains(entity.getPartnerCode())){
//                partnerList.add(entity.getPartnerCode());
//            }
        }

        //判断渠道商是否存在 后面再校验吧....哎...改代码痛苦

        dynamicRebateCommissionService.saveBatch(entities);
        return apiResult;
    }

    /**
     * 导出数据
     * @return
     */
    @Override
    public RebateExportData exportData(DynamicRebateCommissionQueryReqVO vo){
        RebateExportData data = new RebateExportData();
        data.setRebateMainData(queryExportDataMainData(vo));
        data.setRebateOrderData(queryOrderRebateByList(vo));
        data.setRebateHandleData(queryHandleRebateByList(vo));
        data.setRebateCustomerData(queryCustomerRebateByList(vo));
        return data;
    }
}
